#ifndef _MSN_CONTACTS_H
#define _MSN_CONTACTS_H
#include "msn.h"
#include "header.h"
#include "msn_session.h"

typedef struct {
	int fd;
	/* include HTTP header+body of response*/
	int total;
	int in;
	int header_size;
	event_t *ev;
	msn_session_t *ms;
	/* receive correct content */
	int header_parsed;
	FILE *out;
	http_reply_header_t *rh;
	struct in_addr addr;
	/* for other */
	void *data;
}msn_addr_book_t;


extern msn_addr_book_t *msn_addr_book_init(msn_session_t *ms);
extern void msn_addr_book_free(msn_addr_book_t *cl);
/* some soap request */
extern void msn_membership_get(msn_session_t *ms);
extern void msn_contact_list_get(msn_session_t *ms);
extern void msn_contact_add(msn_user_t *user, const char *ticket, MSN_USER_LIST_TYPE type);
extern void msn_contact_del(msn_user_t *user, MSN_USER_LIST_TYPE type);
/* handle <ml> */
extern GString *msn_adl_xml_gen(msn_session_t *ms);
extern GString *msn_adl_xml_gen_one(msn_user_t *user);
/* parse <ml> and add a new contact */
extern msn_user_t * msn_adl_xml_parse(msn_session_t *ms, const char *buf, const int size);
#endif
